<?php
    $CI=& get_instance();
    $CI->load->library('session');
    $total_product = 0;
    if($CI->session->userdata('sp_cart')!=null)
    {
        $sp_cart=$CI->session->userdata('sp_cart');
        foreach($sp_cart as $id => $qty)
        {
            $total_product+=$qty;
        }
    }
    $logged=FALSE;
    if($CI->session->userdata('islogged')== TRUE && $CI->session->userdata('email')!='')
    {
        $logged = TRUE;
        $account=$CI->session->userdata('email');
    }   
?>
<ul>
    <li>
        <a href="#">Tài khoản của tôi</a>
    </li>
    <li>
        <a href="#">Quản lý đơn hàng</a>
    </li>
    <!--
    <li>
        <a href="#">Danh sách ưa thích</a>        
    </li>
    -->
    <li>
        <a href="<?=site_url('view_cart')?>"><?=$total_product!=0?"Giỏ hàng ($total_product)":'Giỏ hàng'?></a>       
    </li>
    <?php
    if($logged==FALSE):
    ?>
    <li>
        <a href="<?=site_url('form_login')?>">Đăng nhập</a>         
    </li>
    <li>
        <a href="#">Đăng ký</a>             
    </li>
    <?php
    else:
    ?>
    <li>
        <a href="#"><?=$account?></a>&nbsp;
        <a href="<?=site_url('logout')?>">[Thoát]</a>
    </li>
    <?php
    endif;
    ?>
</ul>
<div class="clr"></div>